**** Project: Who Accepts Party Policy Change? The Individual-Level Determinants of Policy Change Acceptance
**** Authors: Maurits J. Meijers & Ruth Dassonneville
**** File Info: Data management for Netherlands Kieskompas data
**** Date: January 22, 2024


cd "~/replication"

import spss using "data/NLOZ23-10_Veni+final_231114.sav", case(lower) clear

keep _v3 _v2 _v1 age_4_rec age_6_rec age_7_rec age_cont attention_int attention_post attention_id attention_back attention_cntrl attention_do_attention_int attention_do_attention_post attention_do_attention_id attention_do_attention_back attention_do_attention_cntrl byear edu_2_rec edu_3_rec edu_clean enddate geo_gem geo_nielsen5_rec geo_nielsen6_rec geo_prov_rec know_unemp know_minfin know_un lr pol_int pol_trust_crt pol_trust_gov pol_trust_med pol_trust_pol pol_trust_part pol_trust_parl pol_trust_do_pol_trust_crt pol_trust_do_pol_trust_gov pol_trust_do_pol_trust_med pol_trust_do_pol_trust_pol pol_trust_do_pol_trust_part pol_trust_do_pol_trust_parl pop_will pop_impo pop_cont pop_regu pop_talk pop_comp pop_do_pop_will pop_do_pop_impo pop_do_pop_cont pop_do_pop_regu pop_do_pop_talk pop_do_pop_comp q12_1 q12_2 q12_3 q12_4 q12_5 q12_6 q12_7 q12_8 q12_9 q12_10 q12_10_text responseid sex_rec startdate stdf_1 stdf_2 stdf_3 stdf_4 stdf_5 stdf_6 stdf_7 stdf_8 stdf_9 stdf_10 stdf_11 stdf_12 stdf_13 stdf_14 stdf_15 stdf_16 stdf_17 stdf_18 stdf_items_1_1 stdf_items_1_2 stdf_items_1_3 stdf_items_1_4 stdf_items_1_5 stdf_items_1_6 stdf_items_1_7 stdf_items_1_8 stdf_items_1_9 stdf_items_1_10 stdf_items_1_99 stdf_items_2_1 stdf_items_2_2 stdf_items_2_3 stdf_items_2_4 stdf_items_2_5 stdf_items_2_6 stdf_items_2_7 stdf_items_2_8 stdf_items_2_9 stdf_items_2_10 stdf_items_2_99 stdf_items_3_1 stdf_items_3_2 stdf_items_3_3 stdf_items_3_4 stdf_items_3_5 stdf_items_3_6 stdf_items_3_7 stdf_items_3_8 stdf_items_3_9 stdf_items_3_10 stdf_items_3_99 stdf_items_4_1 stdf_items_4_2 stdf_items_4_3 stdf_items_4_4 stdf_items_4_5 stdf_items_4_6 stdf_items_4_7 stdf_items_4_8 stdf_items_4_9 stdf_items_4_10 stdf_items_4_99 stdf_items_5_1 stdf_items_5_2 stdf_items_5_3 stdf_items_5_4 stdf_items_5_5 stdf_items_5_6 stdf_items_5_7 stdf_items_5_8 stdf_items_5_9 stdf_items_5_10 stdf_items_5_99 stdf_items_6_1 stdf_items_6_2 stdf_items_6_3 stdf_items_6_4 stdf_items_6_5 stdf_items_6_6 stdf_items_6_7 stdf_items_6_8 stdf_items_6_9 stdf_items_6_10 stdf_items_6_99 stdf_open_why stdf_opinion stdf_open_opinion steadfastblock2_do_stdf_opinion symp_1 symp_2 symp_3 symp_4 symp_5 symp_6 symp_7 symp_8 symp_9 symp_10 symp_11 symp_12 symp_13 symp_14 symp_15 symp_16 symp_17 symp_18 tech_exp tech_cpx tech_evi tech_man tech_do_tech_exp tech_do_tech_cpx tech_do_tech_evi tech_do_tech_man to_weight token urb weight

**************************
*** Dependent Variable ***
**************************

**** policy change acceptance ***
gen stdf_opinion2 = stdf_opinion
replace stdf_opinion2 = 4 if stdf_opinion == 99
gen change_accept = 8-stdf_opinion2

*dummy for dks
gen change_accept_dk = 0
replace change_accept_dk = 1 if stdf_opinion ==  99

**************************
*** Independent Variables ***
**************************

*** Extremism: left-right  ***
* With DK as middle value
gen left_right2 = lr + 1 
replace left_right2 = 6 if left_right2 == 100
gen extremism = abs(left_right2 - 6)

*dummy for dks
gen extremism_dk = 0
replace extremism_dk = 1 if lr == 99

*** Technocracy ***
rename tech_exp ru4_1
rename tech_cpx ru4_2
rename tech_evi ru4_3
rename tech_man ru4_4

* With DK as middle value
gen technocracy1_2 = ru4_1
replace technocracy1_2 = 4 if technocracy1_2 == 99 
gen technocracy2_2 = ru4_2 
replace technocracy2_2 = 4 if technocracy2_2 == 99 
gen technocracy3_2 = ru4_3 
replace technocracy3_2 = 4 if technocracy3_2 == 99 
gen technocracy4_2 = ru4_4 
replace technocracy4_2 = 4 if technocracy4_2 == 99 

*dummy for dks
gen technocracy_dk = 0
replace technocracy_dk = 1 if ru4_1 == 99
replace technocracy_dk = 1 if ru4_2 == 99
replace technocracy_dk = 1 if ru4_3 == 99
replace technocracy_dk = 1 if ru4_4 == 99

*** Political Interest ***
* Pol int with DK -> mid value (3)
generate pol_interest = pol_int
replace pol_interest = 3 if pol_int == 99

*dummy for dks
gen pol_interest_dk = 0
replace pol_interest_dk = 1 if pol_int == 99

*** Populist Attitudes ***
rename pop_will ru2_1
rename pop_impo ru2_2
rename pop_cont ru2_3
rename pop_regu ru2_4
rename pop_talk ru2_5
rename pop_comp ru2_6

* with DK -> mid value (4)
gen pop1_2 = ru2_1
replace pop1_2 = 4 if ru2_1 == 99 
gen pop2_2 = ru2_2 
replace pop2_2 = 4 if ru2_2 == 99
gen pop3_2 = ru2_3 
replace pop3_2 = 4 if ru2_3 == 99
gen pop4_2 = ru2_4 
replace pop4_2 = 4 if ru2_4 == 99
gen pop5_2 = ru2_5 
replace pop5_2 = 4 if ru2_5 == 99
gen pop6_2 = ru2_6 
replace pop6_2 = 4 if ru2_6 == 99

*dummy for dks
gen popatt_dk = 0
replace popatt_dk = 1 if ru2_1 == 99
replace popatt_dk = 1 if ru2_2 == 99
replace popatt_dk = 1 if ru2_3 == 99
replace popatt_dk = 1 if ru2_4 == 99
replace popatt_dk = 1 if ru2_5 == 99
replace popatt_dk = 1 if ru2_6 == 99

*** Gender ***
gen gender = sex_rec if sex_rec != .

* Age
drop if age_cont < 18
rename age_cont age

* Education 
rename edu_3_rec education_levels_comb
*model

* Country
gen country = 5

* Preferred party

* Preferred party
foreach var of varlist symp_1-symp_18  {
    generate `var'_new = `var'
    replace `var'_new = . if `var' == 99
	label variable `var'_new "`: variable label `var''"
}

gen which_max = "" 
gen max = 0 
unab xvars : symp_1_new-symp_18_new

quietly foreach x of local xvars { 
    replace which_max = "`x'" if `x' > max & `x' != .
    replace max = `x' if `x' > max & `x' != .
}
 
gen preferred_party_nl = . 
replace preferred_party_nl = 1 if which_max == "symp_1_new"
replace preferred_party_nl = 2 if which_max == "symp_2_new"
replace preferred_party_nl = 3 if which_max == "symp_3_new"
replace preferred_party_nl = 4 if which_max == "symp_4_new"
replace preferred_party_nl = 5 if which_max == "symp_5_new"
replace preferred_party_nl = 6 if which_max == "symp_6_new"
replace preferred_party_nl = 7 if which_max == "symp_7_new"
replace preferred_party_nl = 8 if which_max == "symp_8_new"
replace preferred_party_nl = 9 if which_max == "symp_9_new"
replace preferred_party_nl = 10 if which_max == "symp_10_new"
replace preferred_party_nl = 11 if which_max == "symp_11_new"
replace preferred_party_nl = 12 if which_max == "symp_12_new"
replace preferred_party_nl = 13 if which_max == "symp_13_new"
replace preferred_party_nl = 14 if which_max == "symp_14_new"
replace preferred_party_nl = 15 if which_max == "symp_15_new"
replace preferred_party_nl = 16 if which_max == "symp_16_new"
replace preferred_party_nl = 17 if which_max == "symp_17_new"
replace preferred_party_nl = 18 if which_max == "symp_18_new"

label define preferred_party_nllabel 1 "VVD" 2 "PVV" 3 "CDA" 4 "D66" 5 "GroenLinks" 6 "SP" 7 "PvdA" 8 "CU" 9 "PvdD" 10 "50Plus" 11 "SGP" 12 "DENK" 13 "FvD" 14 "Bij1" 15 "Volt" 16 "BBB" 17 "JA21" 18 "NSC" 
label values preferred_party_nl preferred_party_nllabel

* left/right extremism measure	   
gen extremism_left = .
replace extremism_left = 0 if left_right2>6
replace extremism_left = 1 if left_right2 == 5
replace extremism_left = 2 if left_right2 == 4
replace extremism_left = 3 if left_right2 == 3
replace extremism_left = 4 if left_right2 == 2
replace extremism_left = 5 if left_right2 == 1

gen extremism_right = .
replace extremism_right = 0 if left_right2<6
replace extremism_right = 1 if left_right2 == 7
replace extremism_right = 2 if left_right2 == 8
replace extremism_right = 3 if left_right2 == 9
replace extremism_right = 4 if left_right2 == 10
replace extremism_right = 5 if left_right2 == 11

label var extremism_left "Left-Wing Extremism"
label var extremism_right "Right-Wing Extremism"

* keep 
keep preferred_party_nl stdf_opinion2 change_accept change_accept_dk  left_right2 extremism extremism_dk technocracy1_2 technocracy2_2 technocracy3_2 technocracy4_2 technocracy_dk symp_1_new symp_2_new symp_3_new symp_4_new symp_5_new symp_6_new symp_7_new symp_8_new symp_9_new symp_10_new symp_11_new symp_12_new symp_13_new symp_14_new symp_15_new symp_16_new symp_17_new symp_18_new pol_interest pol_interest_dk pop1_2 pop2_2 pop3_2 pop4_2 pop5_2 pop6_2 popatt_dk gender country which_max max weight education_levels_comb age  stdf_opinion know_unemp know_minfin know_un responseid extremism_right extremism_left

save "data/data_nl.dta", replace
